package org.xs.big_event.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.xs.big_event.dao.class_table.MenuEntry;
import org.xs.big_event.service.IHomeService;
import org.xs.big_event.utils.R;
import org.xs.big_event.utils.ResponseEnum;

import java.util.ArrayList;
import java.util.Map;


@Service
public class HomeService implements IHomeService{

    @Autowired
    private MenuConfigService menuConfigService;
    @Override
//    public R<Map<String, MenuEntry>> GetData() {
//        Map<String, MenuEntry> data = menuConfigService.loadMenuConfig();
//        if (data == null){
//            return R.error(ResponseEnum.FAIL);
//        }
//        return R.ok(data);
//    }
    public R<ArrayList<Map<String, MenuEntry>>> GetData() {
        menuConfigService.setPath("Class.json");
        ArrayList<Map<String, MenuEntry>> data = menuConfigService.loadMenuConfig();
        if (data == null){
            return R.error(ResponseEnum.FAIL);
        }
        return R.ok(data);
    }
}
//@Service
//public class HomeService implements IHomeService {
//    @Autowired
//    private MenuConfigService menuConfigService;
//    @Override
//    public R GetData() {
//        //Object data="响应的数据库数据";
//        Menu data=menuConfigService.loadMenuConfig();
//        R result=R.ok(data);
//        return result;
//    }
//}
